home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / tools / czesc_4 / smallmath / source / spow.a < prev    next >
Text File  |  1993-01-24  |  2KB  |  144 lines

  1.     XDEF _IEEESPPow
  2.  
  3.     SECTION code
  4.  
  5. _IEEESPPow:
  6.     fmove.s     d1,fp1
  7.     fmove.s     d0,fp0
  8.     ftst.x        fp0
  9.     fbogt.w     ArgPositive
  10.     fbeq.w        ArgEQZero
  11.  
  12. ArgNegative:
  13.     fmove.x     fp3,-(sp)
  14.     fint.x        fp1,fp3
  15.     fcmp.x        fp1,fp3
  16.     fbne.w        ReturnNotANumber
  17. NegativeToIntOrInf:
  18.     ftst.x        fp1
  19.     fmovem.l    fpsr,d0
  20.     btst.l        #25,d0
  21.     bne.w        ReturnNotANumber
  22. NegativeToInteger:
  23.     fmove.x     fp2,-(sp)
  24.     fscale.w    #-1,fp3
  25.     fint.x        fp3,fp2
  26.     fcmp.x        fp3,fp2
  27.     fbeq.w        NegativeToEven
  28. NegativeToOdd:
  29.     fmovem.x    (sp)+,fp2/fp3
  30.     fabs.x        fp0
  31.     flogn.x     fp0
  32.     fmul.x        fp0,fp1
  33.     fetox.x     fp1
  34.     fmove.s     fp1,d0
  35.     bset.l        #31,d0
  36.     rts
  37. NegativeToEven:
  38.     fmovem.x    (sp)+,fp2/fp3
  39.     fabs.x        fp0
  40.     flogn.x     fp0
  41.     fmul.x        fp0,fp1
  42.     fetox.x     fp1
  43.     fmove.s     fp1,d0
  44.     rts
  45.  
  46. ArgPositive:
  47.     flogn.x     fp0
  48.     fmul.x        fp0,fp1
  49.     fetox.x     fp1
  50.     fmove.s     fp1,d0
  51.     rts
  52.  
  53. ArgEQZero:
  54.     ftst.x        fp1
  55. ZeroToZero:
  56.     fbeq.w        ReturnNotANumberNoFP2
  57. ZeroToNonZero:
  58.     fmovem.l    fpsr,d0
  59.     btst.l        #25,d0
  60.     bne.w        ZeroToInfinity
  61. ZeroToReal:
  62.     ftst.x        fp0
  63.     fmovem.l    fpsr,d0
  64.     btst.l        #27,d0
  65.     beq.w        PositiveZeroToReal
  66. NegativeZeroToReal:
  67.     fmove.x     fp3,-(sp)
  68.     fint.x        fp1,fp3
  69.     fcmp.x        fp1,fp3
  70.     fbne.w        ReturnNotANumber
  71. NegativeZeroToInteger:
  72.     ftst.x        fp1
  73.     fmovem.l    fpsr,d0
  74.     btst.l        #25,d0
  75.     bne.w        ReturnNotANumber
  76.     fmove.x     fp2,-(sp)
  77.     fscale.w    #-1,fp3
  78.     fint.x        fp3,fp2
  79.     fcmp.x        fp3,fp2
  80.     fbeq.w        NegativeZeroToEven
  81. NegativeZeroToOdd:
  82.     fmovem.x    (sp)+,fp2/fp3
  83.     ftst.x        fp1
  84.     fbogt.w     NegativeZeroToPositiveOdd
  85. NegativeZeroToNegativeOdd:
  86.     move.l        #$FF800000,d0
  87.     rts
  88. NegativeZeroToPositiveOdd:
  89.     move.l        #$80000000,d0
  90.     rts
  91. NegativeZeroToEven:
  92.     fmovem.x    (sp)+,fp2/fp3
  93.     ftst.x        fp1
  94.     fbogt.w     NegativeZeroToPositiveEven
  95. NegativeZeroToNegativeEven:
  96.     move.l        #$7F800000,d0
  97.     rts
  98. NegativeZeroToPositiveEven:
  99.     clr.l        d0
  100.     rts
  101. PositiveZeroToReal:
  102.     ftst.x        fp1
  103.     fbogt.w     PositiveZeroToPositiveReal
  104. PositiveZeroToNegativeReal:
  105.     move.l        #$7F800000,d0
  106.     rts
  107. PositiveZeroToPositiveReal:
  108.     clr.l        d0
  109.     rts
  110. ZeroToInfinity:
  111.     btst.l        #27,d0
  112.     beq.w        ZeroToPositiveInfinity
  113. ZeroToNegativeInfinity:
  114.     ftst.x        fp0
  115.     fmovem.l    fpsr,d0
  116.     btst.l        #27,d0
  117.     beq.w        PositiveZeroToNegativeInfinity
  118. NegativeZeroToNegativeInfinity:
  119.     bra.w        ReturnNotANumberNoFP2
  120. PositiveZeroToNegativeInfinity:
  121.     move.l        #$7F800000,d0
  122.     rts
  123. ZeroToPositiveInfinity:
  124.     ftst.x        fp0
  125.     fmovem.l    fpsr,d0
  126.     btst.l        #27,d0
  127.     beq.w        PositiveZeroToPositiveInfinity
  128. NegativeZeroToPositiveInfinity:
  129.     bra.w        ReturnNotANumberNoFP2
  130. PositiveZeroToPositiveInfinity:
  131.     clr.l        d0
  132.     rts
  133.  
  134.  
  135.  
  136. ReturnNotANumber:
  137.     fmove.x     (sp)+,fp3
  138. ReturnNotANumberNoFP2:
  139.     move.l        #$7FFFFFFF,d0
  140.     rts
  141.  
  142.     END
  143.  
  144.